Base Directory:
/home/ecedu/public_html/new/Models
db = DB::instance()->getConnection();
}
public function getDb(): PDO
{
return $this->db;
}
public function insertOrUpdateBasic(int $typeId, string $desc ): bool
{
$sql = "
INSERT INTO dbs_social_media (type_id, text_title, text_description)
VALUES (:tid, '', :desc )
ON DUPLICATE KEY UPDATE text_description = VALUES(text_description)
";
$stmt = $this->db->prepare($sql);
$stmt->bindValue(':tid', $typeId, PDO::PARAM_INT);
$stmt->bindValue(':desc', $desc, PDO::PARAM_STR);
return $stmt->execute();
}
public function insertOrUpdateNewBasic(int $typeId, string $desc, string $desc1, string $desc2, int $userId, int $type): bool
{
$table="";
if($type==1)
$table="dbs_about_us";
else if($type==2)
$table="dbs_contact_us";
else if($type==3)
$table="dbs_social_media";
$sql = "
INSERT INTO $table (type_id, text_title, text_description, text_description1, text_description2, img_ext, user_id)
VALUES (:tid, '', :desc, :desc1, :desc2, '', :uid)
ON DUPLICATE KEY UPDATE
text_description = VALUES(text_description),
text_description1 = VALUES(text_description1),
text_description2 = VALUES(text_description2),
user_id = VALUES(user_id)
";
$stmt = $this->db->prepare($sql);
$stmt->bindValue(':tid', $typeId, PDO::PARAM_INT);
$stmt->bindValue(':desc', $desc, PDO::PARAM_STR);
$stmt->bindValue(':desc1', $desc1, PDO::PARAM_STR);
$stmt->bindValue(':desc2', $desc2, PDO::PARAM_STR);
$stmt->bindValue(':uid', $userId, PDO::PARAM_INT);
return $stmt->execute();
}
}